package Task14;

import java.util.Arrays;
import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scanner.nextInt();
        }
        //先对数组进行排序操作
        Arrays.sort(arr);
        int res = getCount(arr, n, 0, 0, 1);
        System.out.println(res);
    }
    public static int getCount(int[] arr, int n, int pos, int sum, int mutil) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            sum += arr[i];
            mutil *= arr[i];
            if (sum > mutil) {
                count = count + 1 + getCount(arr, n, i + 1, sum, mutil);
            } else if (arr[i] == 1) {
                count = count + getCount(arr, n, i + 1, sum, mutil);
            } else {
                break;
            }
            sum -= arr[i];
            mutil /= arr[i];
            while(i + 1 < n && arr[i] == arr[i+1]){
                i++;
            }
        }
        return count;
    }
}
